<?php
/**
 * User: hda
 * Date: 2017/4/18
 * Time: 17:28
 * Progress: 0%
 */

namespace app\index\controller;

use logic\admin\index\LPub;
use think\Config;
use think\Controller;
use icontroller\admin\index\IPub;

class Pub extends Controller implements IPub
{
    private $logic;
    public function __construct()
    {
        parent::__construct();
        $this->logic=new LPub();
    }

    public function login()
    {
        return view();
    }

    public function login_submit(){
        $param=array(
            'nick'=>input('username'),
            'password'=>input('password'),
            'captcha'=>input('captcha')
        );
        return $this->logic->login_submit($param);
//        Cookie::set('admin', 1);
    }

    public function logout(){
        $cookie_name = Config::get('const.cookie_name_admin');
        cookie($cookie_name,null);
        $this->redirect(url('index/index'));
    }

    public function lock(){
        return "没有权限";
    }
}